#!/sbin/openrc-run

name="Zigbee2MQTT"

: ${command_user:="zigbee2mqtt"}
: ${start_wait=100}  # milliseconds
: ${retry="TERM/10/KILL/5"}

command="/usr/bin/zigbee2mqtt"
command_background="yes"
pidfile="/run/$RC_SVCNAME.pid"

start_stop_daemon_args="--wait $start_wait $start_stop_daemon_args"
# The leading space is to avoid fallback to $start_stop_daemon_args when this
# is empty (supervise-daemon doesn't support --wait).
supervise_daemon_args=" $supervise_daemon_args"

export ZIGBEE2MQTT_DATA="${datadir:="/var/lib/zigbee2mqtt"}"

depend() {
	need dev localmount
	use mosquitto
}
